package com.ukao.steward.dialog;

import android.support.v4.app.FragmentActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.ukao.steward.R;
import com.ukao.steward.adapter.StoreAdapter;
import com.ukao.steward.bean.BaseListBean;
import com.ukao.steward.bean.StoreBean;
import com.ukao.steward.listener.OnItemClickListener;
import com.ukao.steward.util.DensityUtils;
import com.ukao.steward.util.L;
import com.ukao.steward.util.Utils;
import com.ukao.steward.widget.CustomPopWindow;

import java.util.List;

import static cn.jpush.android.api.JPushInterface.a.s;

/**
 * Created by ukaodev on 2018/3/30.
 */

public class PopWindowHelp {



    public static    CustomPopWindow showPopStoreList(View parent , FragmentActivity _mActivity, List<StoreBean>  mData,OnItemClickListener itemClickListener) {

        View contentView = LayoutInflater.from(_mActivity).inflate(R.layout.popwindow_store_layout, null);
        RecyclerView recyclerview = (RecyclerView) contentView.findViewById(R.id.recycler_view);
        recyclerview.setLayoutManager(new LinearLayoutManager(_mActivity));
        StoreAdapter mStoreAdapter = new StoreAdapter(_mActivity,mData);
          mStoreAdapter.setOnItemClickListener(itemClickListener);
        recyclerview.setAdapter(mStoreAdapter);
        CustomPopWindow mEnterFactoryWindow = new CustomPopWindow.PopupWindowBuilder(_mActivity)
                .setView(contentView)
                .enableBackgroundDark(true) //弹出popWindow时，背景是否变暗
                .size(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)//显示大小
                .create()
                .showAsDropDown(parent);


        return mEnterFactoryWindow;
    }

}
